package com.sxm.yiwei.tools;

/**
 * Created by KuKa on 2017/9/19.
 * 正则工具类
 */

public class REXTools {



    // 手机号验证
    public static boolean isPhoneNumber(String phone) {
        String isPhone = "[1][34578]\\d{9}";
        boolean matches = phone.matches(isPhone);

        return matches;

    }

    public static String hidePhone(String phone){
       // 用****替换手机号码中间4位
        String maskNumber = phone.substring(0,3)+"****"+phone.substring(7,phone.length());
        return maskNumber;
    }
    public static String hideAddress(String address){
        // 用****替换手机号码中间4位
        int i = address.length() / 2;
        String masadd = address.substring(0,i)+"****";
        return masadd;
    }
}
